package com.gdth.service;

import java.util.List;

import com.gdth.bank.utils.AppUtil;
import com.gdth.utils.DateTimeUtil;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class HeartReceiver extends BroadcastReceiver {
	private static final String TAG = "HeartReceiver";
	 
	@Override
	public void onReceive(Context arg0, Intent arg1) {
		// TODO Auto-generated method stub

		Log.e(TAG, "HeartService Run: " + DateTimeUtil.getCurrentTime());
		
		Intent intent = new Intent(arg0, HeartService.class);
		arg0.startService(intent);
		
		boolean b = AppUtil.isServiceWorked(arg0, "com.gdth.service.BankService");
		if(!b) {
			Intent service = new Intent(arg0, BankService.class);
			arg0.startService(service);
			Log.e(TAG, "重新启动BankService");
		}
	}
	

}
